package com.jf.hotelreservation.demos.controller;

import com.jf.hotelreservation.demos.bean.Reservation;
import com.jf.hotelreservation.demos.service.ReservationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/reservation")
public class ReservationMController {

    @Autowired
    private ReservationService reservationService;

    @PostMapping("/addReservation")
    public String addReservation(@RequestBody  Reservation reservation){
        System.out.println(reservation.toString());
        return reservationService.addReservation(reservation);
    }

    @GetMapping("/queryAll")
    public String queryAll(Integer currentPage, Integer pageSize){
        return reservationService.queryAll(currentPage,pageSize);
    }
}
